-
Notifications
You must be signed in to change notification settings - Fork 6
Proper fixup for " when generating CQL query #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The replaceAll for looking back whether the " was escaped did not work as the preceding backslash could have been the result of escaping a backslash itself. A follow up for #5
|
|
||
| static String maybeQuote(String str) { | ||
| if (str == null) | ||
| if (str == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamdickmeiss this function name is confusing since it both quotes and escapes. Btw, we should do the same in cql-go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, the function name is bad.
There will never be a bare " as the result of a query in the current form. But it did happen in latest release until #5. This is just extra precaution to ensure that if it is bare, it will be escaped. That's all.
| if (ch == '"' && !escaped) { | ||
| sb.append('\\'); | ||
| } | ||
| escaped = ch == '\\' && !escaped; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamdickmeiss what if \ is on the last position like in x\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be left as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the resulting query will be invalid no?
The replaceAll for looking back whether the " was escaped did not work as the preceding backslash could have been the result of escaping a backslash itself.
A follow up for #5